#!/usr/bin/env python

# this incredibly important script will take a bunch of files
# that have been fucked up by Excel (because the lines end with \r)
# and fixes them (by replacing it with the newline character, \n)
# If the files don't have \r characters, nothing should happen

# example usage:
# user$ python fix_newlines.py ./all_the_files/*.csv

import sys

for p in sys.argv[1:]:
    print p
    with open(p) as f:
        t = f.read()
    
    with open(p, 'w') as OUT:
        OUT.write(t.replace('\r', '\n'))
